<template>
    <div class='page-content'>
        <el-form ref="model" :model="model" label-width="150px">
            <el-form-item label="客服电话">
                <el-input v-model="model.service_mobile" placeholder="请输入客服电话" style="width:50%"></el-input>
            </el-form-item>
            <el-form-item label="邮箱">
                <el-input v-model="model.email" type="text" placeholder="请输入邮箱" style="width:50%"></el-input>
            </el-form-item>
            <!-- <el-form-item label="验证码有效时间(分钟)">
                <el-input v-model="model.code_minute" placeholder="请输入验证码有效时间(分钟)" style="width:50%"></el-input>
            </el-form-item>
            <el-form-item label="IP校验">
                <el-select v-model="model.start_ip_status" style="width:50%" placeholder="请选择IP校验类型">
                    <el-option label="不校验" value="1"></el-option>
                    <el-option label="只校验禁止IP" value="2"></el-option>
                    <el-option label="只校验允许IP" value="3"></el-option>
                </el-select>
            </el-form-item> -->
            <!--<el-form-item label="隐私规则">
                <quill-editor class="editor" ref="quillEditor" style="width: 80%" v-model="model.private_rule" :options="editorOption"/>
            </el-form-item>-->
        </el-form>
        <el-button type="primary" @click="onSubmit">修改</el-button>
    </div>
</template>

<script>
    import {getOtherConfig, editOtherConfig} from '@/api/sys/otherConfigApi';
    import quillConfig from "@/utils/quill-config.js";
    import {quillEditor} from 'vue-quill-editor';
    import 'quill/dist/quill.core.css'
    import 'quill/dist/quill.snow.css'
    import 'quill/dist/quill.bubble.css'
    import '@/config/quill/quill.scss'

    export default {
        components: {
            quillEditor
        },
        data() {
            return {
                model: {},
                editorOption: quillConfig,
            };
        },
        created: function () {
            this.load();
        },
        methods: {
            load: function () {
                getOtherConfig().then(res => {
                    if (res.code === 1) {
                        this.model = res.data.model;
                    }
                })
            },
            onSubmit: function () {
                editOtherConfig({
                    id: this.model.id,
                    service_mobile: this.model.service_mobile,
                    email:this.model.email,
                }).then(res => {
                    if (res.code === 1) {
                        this.$message({
                            message: '操作成功',
                            type: 'success'
                        });
                        this.load();
                    }
                })
            },
        }
    }
</script>

<style lang='scss' scoped>
    .page-content {
        width: 100%;
        height: 100%;
    }
</style>
